﻿<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<CallMVC.Models.LoginModel>" %>



<asp:Content ID="calculationTitle" ContentPlaceHolderID="Title1" runat="server">
             <%
      DBManager.Customer cust = ViewBag.Customer;
  
       %>

   <a href="<%: Url.Action("Calculation", "Home", new { customerId = cust.CustomerID })%>"><img src="/CalcApp/images/<%= cust.LogoLink %>"  /></a>
</asp:Content>

<asp:Content ID="calculationContent" ContentPlaceHolderID="MainContent" runat="server">
    
    <% using (Html.BeginForm()) {
           DBManager.Calculation calculation = (DBManager.Calculation)this.ViewBag.Calculation;
           System.Collections.Generic.List<DBManager.OrderControl> orderList = (System.Collections.Generic.List<DBManager.OrderControl>)this.ViewBag.Orders;
          
            %>
        <%: Html.ValidationSummary() %>

            <ul data-role="listview" data-inset="true">
            <li data-role="listview"><h3><%: Html.Label(calculation.CaculationName) %></h3></li>
            </ul>
            <%
           string data_filter = "true";

           string data_filter_text = "Filter items";

           if (calculation.Customer.TextFilterItems != null)
               data_filter_text = calculation.Customer.TextFilterItems;

           if (orderList.Count <= 10)
           {
               data_filter = "false";
           }
             %>
            <ul data-role="listview" data-filter="<%=data_filter %>" data-filter-placeholder="<%=data_filter_text %>" >
            <%  
           
           foreach (DBManager.OrderControl orderControl in orderList)
            {
               
                %>
                <li>
                <%:       
                Html.ActionLink(orderControl.OrderName, "CalcInput", new { calculationId = calculation.CalculationID, orderId = orderControl.ID.ToString() })
                %>
                </li>
                <% 
            }
                    %>
            </ul>
        
    
    <br />

        <% } %>
    
</asp:Content>